package com.scanner.net;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Response;

public class RxDownLoadInterceptor implements Interceptor {

    private RxProgressListener listener;

    public RxDownLoadInterceptor(RxProgressListener listener) {
        this.listener = listener;
    }


    @Override
    public Response intercept(Chain chain) throws IOException {
        Response response = chain.proceed(chain.request());
        return response.newBuilder().body(new RxProgressResponseBody(response.body(), listener)).build();
    }
}
